//
//  AudioStreamAnalyzer.h
//  AudioProj
//
//  Created by  on 13-4-11.
//  Copyright (c) 2013年 AISpeech. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <AudioToolbox/AudioToolbox.h>

@class AudioStreamAnalyzer;

typedef struct
{
    AudioStreamBasicDescription asbd;
    SInt64 dataOffset;
    UInt32 isReadyReadPacket;
    void * magicCookieData;
    UInt32 magicCookieSize;
} AudioFilePropertyInfo;

@interface AudioFilePacketInfo : NSObject 
{
@public
    AudioStreamAnalyzer *analyzer;
    NSData *audioData;
    UInt32 packetCount;
    AudioStreamPacketDescription *packetDesc;
}
@end

@interface AudioStreamAnalyzer : NSObject
{
@private
    AudioFileStreamID streamID;
    AudioFilePropertyInfo propertyInfo;
    BOOL isStreamOpened;
    id delegate;
    SEL analysisPropertyDidFinished;
    SEL audioStreamDidReceivedData;
}

@property(nonatomic,readonly)BOOL isStreamOpened;
@property(nonatomic,assign)SEL analysisPropertyDidFinished;
@property(nonatomic,assign)SEL audioStreamDidReceivedData;

- (id)initWithDelegate:(id)aDelegate;
- (BOOL)openStream;
- (BOOL)parseBytes:(NSData *)data;
- (BOOL)closeStream;
- (AudioFilePropertyInfo)get_AudioFilePropertyInfo;

@end
